package cn.mw.cmdb.entity;

import cn.mw.cmdb.service.ServiceChoose;
import cn.mw.cmdb.service.impl.ModelSpecificationServiceImpl;
import cn.mw.cmdb.util.DataCreateInfo;
import cn.mw.components.mongodb.anno.AutoId;
import cn.mw.components.mongodb.anno.CMDBProperty;
import cn.mw.components.mongodb.anno.CMDBRelations;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Data
@Document("mw_cmdbmd_vendor_specification")
public class ModelSpecificationInfo implements ServiceChoose, DataCreateInfo {
    @CMDBProperty
    @AutoId
    @Schema(description = "id")
    protected String id;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "规格型号")
    protected String specification;

    @CMDBProperty(searchType = PropertyTypeInt.ID)
    @Schema(description = "类型:0-软件，1-硬件")
    protected Integer type;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "备注")
    protected String description;


    @CMDBProperty(searchType = PropertyTypeInt.ID)
    @Schema(description = "设备高度-类型为硬件时显示")
    protected Integer deviceHeight;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "厂商Id'")
    protected String vendorId;

    //厂商名称
    @Transient
    @CMDBProperty(searchType = PropertyTypeString.ID)
    @CMDBRelations(targetClass = ModelVendorInfo.class, targetField = "vendorCN", localField = "vendorId", foreignField = "_id")
    private String vendor;


    @CMDBProperty(searchType = PropertyTypeString.ID,keywordSearch = true)
    @Schema(description = "创建人")
    protected Long creater;

    @CMDBProperty(searchType = PropertyTypeTime.ID)
    @Schema(description = "创建时间")
    protected Date createTime;

    @CMDBProperty(searchType = PropertyTypeString.ID,keywordSearch = true)
    @Schema(description = "修改人")
    protected Long modifier;

    @CMDBProperty(searchType = PropertyTypeTime.ID)
    @Schema(description = "修改时间")
    protected Date modificationTime;

    @CMDBProperty(logicDel = true)
    protected Boolean delFlag = false;
    @Override
    @Schema(description = "模型服务Id")
    public String getServiceId() {
        return ModelSpecificationServiceImpl.ID;
    }
}
